<?php

class Application_Form_ResetPassword extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');
 
        $this->addElement('password', 'password', array(
            'label'      => 'account_preset_pass1_label',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20))
            )
        ));
        $this->addElement('password', 'password2', array(
            'label'      => 'account_preset_pass2_label',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20)),
                array('identical', false, array('token' => 'password', 'messages' => array('notSame' => 'password_are_not_equal'), 'strict' => true))
            )
        ));

        // Add a captcha
        $this->addElement('captcha', 'captcha', array(
            'label'      => 'account_preset_captcha_label',
            'required'   => true,
            'captcha'    => array(
                'captcha' => 'Figlet',
                'wordLen' => 4,
                'timeout' => 300
            )
        ));
 
        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'account_preset_submit_label',
        ));
 
        // And finally add some CSRF protection
        $this->addElement('hash', 'csrf', array(
            'ignore' => true,
        ));
    }
}

